import requests
from lxml import etree
import re

headers = {
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) '
                  'AppleWebKit/537.36 (KHTML, like Gecko) '
                  'Chrome/91.0.4472.106 Safari/537.36',
    'Referer': 'https://www.douyin.com/'
}

url = 'https://www.douyin.com/search/%E7%BE%8E%E5%A5%B3'

page_text = requests.get(url=url, headers=headers).text
# print(page_text)
# page = re.search('<ul[\w.-/%]*</ul>', page_text)
# print(page)
tree = etree.HTML(page_text)
li_list = tree.xpath('//*[@id="root"]/div/div[2]/div/div[2]')
print(li_list)
# print(li_list[0].xpath('./div[2]'))
# print(test))
# for li in li_list:
#     name = li.xpath('./div/a/div/div/img@alt')[0]
#     print(name)
